import React from 'react'
import qs from 'qs'
import { useLocation, useParams } from 'react-router-dom'
export default function List() {
    const location = useLocation()
    const { user } = qs.parse(location.search.split('?')[1])
    const { id } = useParams()
    const stateList=location.state
    return (
        <div>
            <p> 用户名：{user} 用户编号：{id}</p>
            <ul>
                {
                    stateList.map(item=>{
                        return <li key={item.id}>{item.name}</li>
                    })
                }
            </ul>
        </div>
    )
}
